package hot;

import java.util.HashSet;

/**
 * @author way
 * @create 2025-03-08 21:52
 */
public class _41_firstMissingPositive {
    public int firstMissingPositive(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        for (int num : nums) {
            set.add(num);
        }

        for (int i = 1; i < Integer.MAX_VALUE; i++) {
            if (!set.contains(i)) {
                return i;
            }
        }
        return 0;
    }
}
